package com.myutils.commons.utils.os;


import com.myutils.commons.BaseParams;

public class PathUtilsParams extends BaseParams {

    /**
     * 路径拼接参数构造
     *
     * @return
     */
    public Object[] joinParams() {
        return $($("/home\\myname/file", new String[]{"abc\\", "123", "789/", "test.txt"},
                "/home/myname/file/abc/123/789/test.txt"),
                $("myname/file/", new String[]{"123/", "abc", "test"}, "myname/file/123/abc/test"),
                $("myname/f/", new String[]{"", "", "123/wd/as", ""}, "myname/f/123/wd/as/"),
                $("/home/file", new String[]{"123", "/myname", "123", "/abc", "test.txt"},
                        "/abc/test.txt"),
                $("", new String[]{}, ""));
    }

    /**
     * 路径拼接参数构造（异常测试）
     *
     * @return
     */
    public Object[] joinIsNullParams() {
        return $($(null, new String[]{}), $("", null));
    }

    /**
     * 文件路径、文件名、文件后缀获取测试方法参数构造
     *
     * @return
     */
    public Object[] splitextParams() {
        return $($("abc.txt", new String[]{"", "abc", ".txt"}),
                $("/abc", new String[]{"/", "abc", ""}),
                $("abc/sdf/wa\\ds/aa.doc", new String[]{"abc/sdf/wa/ds/", "aa", ".doc"}),
                $(".", new String[]{"", ".", ""}),
                $(".xls", new String[]{"", ".xls", ""}),
                $("abc.sdf.sefe.xls", new String[]{"", "abc.sdf.sefe", ".xls"}),
                $("ef./sdf.efef\\a,ks.mp4", new String[]{"ef./sdf.efef/", "a,ks", ".mp4"}),
                $("ef./sdf.ef  ef\\a,ks.mp4", new String[]{"ef./sdf.ef  ef/", "a,ks", ".mp4"}),
                $("E:\\df\\ewf/sd.mp4", new String[]{"E:/df/ewf/", "sd", ".mp4"}));
    }

    /**
     * 文件路径分隔符转换参数构造
     *
     * @return
     */
    public Object[] sepConvertParams() {
        return $(
                $("\\home/abc\\a.txt", "/home/abc/a.txt"),
                $("abc\\\\测试目录\\\\\\abc/", "abc//测试目录///abc/"),
                $("", ""),
                $("abc/sd\\\\ad", "abc/sd//ad"));
    }

}
